package com.aaa.a1109.demo01;

/**
 * @author 荆豪峰
 * @version 1.0
 */
public class Test01 {
 public static void main(String[] args) {
     MX mx = new MX();
     JJR jjr = new JJR(mx);
     jjr.dance();
     jjr.sing();
 }
}
interface MXGN {
   public void sing();
   public void dance();
}
class MX implements MXGN{

    @Override
    public void sing() {
        System.out.println("明星会唱");
    }

    @Override
    public void dance() {
        System.out.println("明星会跳");
    }
}
class JJR implements MXGN {
    private MX target;

    public JJR(MX target) {
        this.target = target;
    }
    public void DZH() {
        System.out.println("打招呼");
    }

    public void DX() {
        System.out.println("答谢");
    }
    @Override
    public void sing() {
        DZH();
        target.dance();
        target.sing();
        DX();
    }

    @Override
    public void dance() {
        DZH();
        target.dance();
        target.sing();
        DX();
    }
}